//
//  TCLYCommunityView.m
//  YuErmuYing
//
//  Created by LYang on 16/8/13.
//  Copyright © 2016年 Tiancheng. All rights reserved.
//

#import "TCLYCommunityView.h"
#import "Masonry.h"
#import "UIView+HB.h"

@implementation TCLYCommunityView

-(instancetype) init{
    if (self = [super init]) {
        self.titleView = [[UIView alloc] init];
        [self addSubview:self.titleView];
        [self.titleView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self.mas_left).offset(12);
            make.right.mas_equalTo(self.mas_right).offset(-12);
            make.top.mas_equalTo(self.mas_top);
        }];
        self.titleTextView = [[UITextView alloc] init];
//        //背景色
//        self.titleTextView.backgroundColor = [UIColor blueColor];
        self.titleTextView.scrollEnabled = NO;    //当文字超过视图的边框时是否允许滑动，默认为“YES”
        self.titleTextView.editable = YES;        //是否允许编辑内容，默认为“YES”
        self.titleTextView.font=[UIFont fontWithName:@"Arial" size:14.0]; //设置字体名字和字体大小;
        self.titleTextView.returnKeyType = UIReturnKeyDefault;//return键的类型
        self.titleTextView.keyboardType = UIKeyboardTypeDefault;//键盘类型
        self.titleTextView.textAlignment = NSTextAlignmentLeft; //文本显示的位置默认为居左
        self.titleTextView.dataDetectorTypes = UIDataDetectorTypeAll; //显示数据类型的连接模式（如电话号码、网址、地址等）
        self.titleTextView.textColor = [UIColor blackColor];
        self.titleTextView.text = @"标题";//设置显示的文本内容
        [self.titleView addSubview:self.titleTextView];
        [self.titleTextView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.titleView);
            make.left.mas_equalTo(self.titleView);
            make.right.mas_equalTo(self.titleView);
            make.bottom.mas_equalTo(self.titleView);
        }];
        NSLog(@"%f",self.titleTextView.frame.size.height);
        UIImageView * lineImageView = [[UIImageView alloc] init];
        lineImageView.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:lineImageView];
        [lineImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.titleView.mas_bottom).offset(6);
            make.left.mas_equalTo(self.titleView);
            make.right.mas_equalTo(self.titleView);
            make.height.mas_equalTo(2);
        }];
        self.conteneView = [[UIView alloc] init];
        [self addSubview:self.conteneView];
        [self.conteneView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(lineImageView.mas_bottom).offset(6);
            make.left.mas_equalTo(self.mas_left).offset(12);
            make.right.mas_equalTo(self.mas_right).offset(-12);
        }];
        self.contentTextView = [[UITextView alloc] init];
        //背景色
//        self.contentTextView.backgroundColor = [UIColor redColor];
        self.contentTextView.scrollEnabled = NO;    //当文字超过视图的边框时是否允许滑动，默认为“YES”
        self.contentTextView.editable = YES;        //是否允许编辑内容，默认为“YES”
        self.contentTextView.font=[UIFont fontWithName:@"Arial" size:12.0]; //设置字体名字和字体大小;
        self.contentTextView.returnKeyType = UIReturnKeyDefault;//return键的类型
        self.contentTextView.keyboardType = UIKeyboardTypeDefault;//键盘类型
        self.contentTextView.textAlignment = NSTextAlignmentLeft; //文本显示的位置默认为居左
        self.contentTextView.dataDetectorTypes = UIDataDetectorTypeAll; //显示数据类型的连接模式（如电话号码、网址、地址等）
        self.contentTextView.textColor = [UIColor blackColor];
        self.contentTextView.text = @"内容";//设置显示的文本内容
        [self.conteneView addSubview:self.contentTextView];
        [self.contentTextView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(self.conteneView);
            make.left.mas_equalTo(self.conteneView);
            make.right.mas_equalTo(self.conteneView);
            make.bottom.mas_equalTo(self.conteneView);
        }];

    }
    return self;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
